/* Formulario para visualizar las acciones de
 * las unidades
 * + Mover Unidad
 * + Atacar
 */
function UnitDetails(_unitView){
	
	var AnnotationType = require('ui/model/constants/AnnotationType');
	
	//Unidad
	var unitView = _unitView;
	
	var self = Ti.UI.createView({
		backgroundColor:'lightgray',
		right:'0%',
		width:'30%'
	});
	
	var title = Ti.UI.createLabel({
		text:'Detalle ' + AnnotationType.GetTypeDescriptionAnnotation(unitView.type),
		top:'0px',
		color: '#900',
  		font: { fontSize:14, fontWeight:'bold', textStyle:Titanium.UI.TEXT_STYLE_HEADLINE },
  		shadowRadius: 3,
  		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
  		width: Ti.UI.SIZE, height: Ti.UI.SIZE
	});
	
	var btnMove = Ti.UI.createButton({
		title:'Avanzar',
		top: '50px',
		font: { fontSize:14 }
	});
		
	var btnAttack = Ti.UI.createButton({
		title:'Atacar',
		top: '130px',
		font: { fontSize:14 }
	});
	
	btnMove.addEventListener('click',function(){
		unitView.move();
	});
	
	var lblCurrentLatitude = Ti.UI.createLabel({
		text: 'Current Lat: ' + unitView.currentLatitude,
		top:'200px',
		color: '#900',
		font: { fontSize:14, fontWeight:'bold', textStyle:Titanium.UI.TEXT_STYLE_HEADLINE },
  		shadowRadius: 3,
  		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
  		width: Ti.UI.SIZE, height: Ti.UI.SIZE
	});

	var lblCurrentLongitude = Ti.UI.createLabel({
		text: 'Current Long: ' + unitView.currentLongitude,
		top:'280px',
		color: '#900',
		font: { fontSize:14, fontWeight:'bold', textStyle:Titanium.UI.TEXT_STYLE_HEADLINE },
  		shadowRadius: 3,
  		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
  		width: Ti.UI.SIZE, height: Ti.UI.SIZE
	});
		
	var lblNewLatitude = Ti.UI.createLabel({
		text: 'New Lat: ' + unitView.newLatitude,
		top:'360px',
		color: '#900',
		font: { fontSize:14, fontWeight:'bold', textStyle:Titanium.UI.TEXT_STYLE_HEADLINE },
  		shadowRadius: 3,
  		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
  		width: Ti.UI.SIZE, height: Ti.UI.SIZE
	});

	var lblNewLongitude = Ti.UI.createLabel({
		text: 'New Long: ' + unitView.newLongitude,
		top:'440px',
		color: '#900',
		font: { fontSize:14, fontWeight:'bold', textStyle:Titanium.UI.TEXT_STYLE_HEADLINE },
  		shadowRadius: 3,
  		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
  		width: Ti.UI.SIZE, height: Ti.UI.SIZE
	});

		
	self.add(title);
	self.add(btnMove);
	self.add(btnAttack);
	self.add(lblCurrentLatitude);
	self.add(lblCurrentLongitude);
	self.add(lblNewLatitude);
	self.add(lblNewLongitude);
	
	return self;
	
}

module.exports = UnitDetails;
